package org.boge.sharpdoc.config;

import org.boge.sharpdoc.interceptor.AdminInterceptor;
import org.boge.sharpdoc.interceptor.CustomerInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfiguration implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        WebMvcConfigurer.super.addInterceptors(registry);
        registry.addInterceptor(new CustomerInterceptor())
                .addPathPatterns("/collect/showCollect","/care/showCare");
        registry.addInterceptor(new AdminInterceptor())
                .addPathPatterns("/**/admin/**")
                .excludePathPatterns("/admin/loginPage","/admin/login");
    }
}
